package com.jyx.refactor.beginner;

import com.jyx.refactor.beginner.service.Price;
import com.jyx.refactor.beginner.service.impl.ChildrenPrice;
import com.jyx.refactor.beginner.service.impl.NewReleasePrice;
import com.jyx.refactor.beginner.service.impl.RegularPrice;

/**
 * 影片
 * author 		jyx
 * email 		jyxsuper@163.com
 * description: Movie
 * Company: 	myzczk
 * datetime: 	2017年9月19日 上午10:22:25
 */
public class Movie {
	
	public static final int CHILDRENS = 2;// children 儿童片
	public static final int REGULAR = 0;  // regular 普通片
	public static final int NEW_RELEASE = 1; // new_release(发行)  新片
	
	private String _title; // 名称
	private Price _price;// 价格代号
	
	/**
	 * 计算单项租金
	 * @param daysRented
	 * @return
	 */
	public double calcAmount(int daysRented){
		return _price.calcAmount(daysRented);
	}
	
	/**
	 * 计算单项积分
	 * @param daysRented
	 * @return
	 */
	public int calcIntegral(int daysRented){
		return _price.calcIntegral(daysRented); 
	}
	
	
	public Movie(String _title, int _priceCode) {
		super();
		this._title = _title;
		set_price(_priceCode);
	}

	public String get_title() {
		return _title;
	}

	public void set_title(String _title) {
		this._title = _title;
	}

	public Price get_price() {
		return _price;
	}

	public void set_price(int _priceCode) {
		switch (_priceCode) {
			case REGULAR :
				_price = new RegularPrice(); 
				break;
			case CHILDRENS:
				_price = new ChildrenPrice();
				break;
			case NEW_RELEASE:
				_price = new NewReleasePrice();
				break;
		}
	}
	
	
	
}
